package com.github.sbb.sherry.primitives.core;

import com.github.sbb.sherry.common.base.Preconditions;
import java.util.Map;

public class MapKeyCheckedFact extends MapFact {

  public MapKeyCheckedFact() {
    super();
  }

  public MapKeyCheckedFact(Map<String, Object> data) {
    super(data);
  }

  @Override
  public Object get(String fieldName) {
    Preconditions.checkArgument(contains(fieldName), "%s 不存在", fieldName);
    return super.get(fieldName);
  }

  @Override
  public String getString(String fieldName) {
    Preconditions.checkArgument(contains(fieldName), "%s 不存在", fieldName);
    return super.getString(fieldName);
  }

  @Override
  public Integer getInteger(String fieldName) {
    Preconditions.checkArgument(contains(fieldName), "%s 不存在", fieldName);
    return super.getInteger(fieldName);
  }
}
